#include "win.h"
#include <QPainter>
#include "mypushbutton.h"
#include <QDebug>
#include <QTimer>

Win::Win(QWidget *parent) : QMainWindow(parent)
{
    this->setFixedSize(1200,800);

    this->setWindowIcon(QPixmap(":/pictures/title.png"));

    this->setWindowTitle("结束");

    MyPushButton * quitBtn = new MyPushButton(":/pictures/quitbutton.png");
    quitBtn->setParent(this);
    quitBtn->move(this->width()-quitBtn->width(),this->height()-quitBtn->height());

    connect(quitBtn,&MyPushButton::clicked,[=](){

        quitBtn->zoom1();
        quitBtn->zoom2();

        QTimer::singleShot(500,this,[=](){
            this->close();
        });
    });
}

void Win::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/pictures/win.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
}
